import React from 'react';
import ReactDOM from 'react-dom';
import { HashRouter as Router, Route, Switch, Redirect } from 'react-router-dom';
// import { Provider } from 'react-redux';
import App from '@/App';
import Login from '@/components/login/Login';
import Register from '@/components/register/Register';
import Works from '@/components/works/Works';
import Menu from '@/components/menu/Menu';
import Kind from '@/components/kind/Kind';
import Classify from '@/components/kind/Classify';
import Home from '@/components/home/Home';
import Mine from '@/components/mine/Mine';
import Users from '@/components/users/Users';
import Detail from '@/components/detail/Detail';
import * as serviceWorker from '@/serviceWorker';
import './main.scss';

ReactDOM.render(
  <Router>
    <Switch>
      <Route path='/detail/:id' component = { Detail } />
      <Route path='/mine' component = { Mine } />
      <Route path='/users/:id' component = { Users } />
      <Route path='/login' component = { Login } />
      <Route path='/register' component = { Register } />       
      <Route path='/works' component = { Works } />
      <Route path='/menu' component = { Menu } />
      <Route path='/kind' component = { Kind } />
      <Route path='/fkind' component = { Classify } />
      <Route path='/home' component = { Home } />
      <Route path='/' component = { App } />
      <Redirect from = "/" to = "/home"/>
    </Switch>
  </Router>
  , document.getElementById('root'));

//如果希望应用程序离线工作并更快地加载，可以更改
//unregister()到下面的register()。注意，这有一些陷阱。
//了解更多关于服务工作者的信息：http://bit.ly/CRA-PWA
// serviceWorker.unregister();
// 如果需要打包并且缓存的时候，改为
// serviceWorker.register();
process.env.NODE_ENV === 'production' ? serviceWorker.register() : serviceWorker.unregister()
